﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Vds2465Telegrams
{
	public enum eNetStatus
	{
		/// <summary>
		/// 0x00
		/// </summary>
		OK,

		/// <summary>
		/// 0x08
		/// </summary>
		Outage,

		/// <summary>
		/// 0x10
		/// </summary>
		Busy,

		/// <summary>
		/// 0x11
		/// </summary>
		SubscriberNotReachable,

		/// <summary>
		/// 0x12
		/// </summary>
		WrongNumber,

		/// <summary>
		/// 0x80
		/// </summary>
		TransparentASCIIReport
	}

	public class UserData_60_NetStatus : UserData
	{
		#region private member variables

        private readonly eNetStatus _netStatus;
		
		#endregion private member variables

		#region constructor

		public UserData_60_NetStatus(eNetStatus netStatus)
            : base(UserData.UserData60NetStatus)
		{
            _netStatus = netStatus;
		}

		#endregion constructor

		#region getters

		public eNetStatus NetStatus { get { return _netStatus; } }

		#endregion getters

		#region ToString, Equals, GetHashCode

		public override int GetHashCode()
		{
			int hashCode = base.GetHashCode();
			hashCode ^= (byte)_netStatus;

			return hashCode;
		}

		public override string ToString()
		{
			StringBuilder stringBuilder = new StringBuilder();
			stringBuilder.Append("(");
			stringBuilder.Append(ToStringProperties());
			stringBuilder.Append(")");

			return stringBuilder.ToString();
		}

		internal override string ToStringProperties()
		{
			StringBuilder stringBuilder = new StringBuilder();
			stringBuilder.Append(base.ToStringProperties());
			stringBuilder.Append(", ");

            stringBuilder.Append("NetStatus='");
            stringBuilder.Append(NetStatus);
			stringBuilder.Append("'");
			return stringBuilder.ToString();
		}

		public override bool Equals(object obj)
		{
			Type objType = obj.GetType();
			if (this.GetType() == objType)
			{
				UserData_60_NetStatus userData2Compare = obj as UserData_60_NetStatus;
                return EqualsProperties(userData2Compare);
			}

			return false;
		}

		internal bool EqualsProperties(UserData_60_NetStatus userData2Compare)
		{
            if (base.EqualsProperties(userData2Compare))
			{
				return (NetStatus == userData2Compare.NetStatus);
			}

			return false;
		}		

		#endregion ToString, Equals, GetHashCode
	}
}
